/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ace.game.entity.pickup;

import ace.game.Sprite;
import ace.system.Utilities;
import ace.system.xml.XmlNode;

/**
 *
 * @author Hallucinogen
 */
public class PickupData {
    protected PickupData() {
		//Initialize
		mLife		= 0;
		mHealth		= 0;
		mScore		= 0;
		mSprite		= null;
	}

	public PickupData(XmlNode xml) {
		//Default
		this();

		//Prepare variable
		XmlNode imageNode		= null;

		//For each child
		for (int i = 0; i < xml.getChildren().size(); i++) {
			//Get variable
			XmlNode Node	= (XmlNode)xml.getChildren().elementAt(i);
			String Tag		= Node.getNodeName();
			String Value	= ((XmlNode)Node.getChildren().elementAt(0)).getNodeValue();

			//Check based on tag name
			if (Tag.equals("score"))			mScore			= Integer.parseInt(Value);
			else if (Tag.equals("health"))		mHealth			= Integer.parseInt(Value);
			else if (Tag.equals("sprite"))		imageNode		= Node;
			else if (Tag.equals("life"))        mLife           = Integer.parseInt(Value);
		}
		//Create sprite
		if (imageNode != null) {
			mSprite = new Sprite(imageNode, Utilities.PICKUP_FOLDER);
		}
	}

	public int getScore()				{	return mScore;		}
	public int getHealth()				{	return mHealth;     }
	public int getLife()				{	return mLife;       }
	public Sprite getSprite()			{	return mSprite;		}

	//Data
	protected int	mLife;
	protected int	mHealth;
	protected int	mScore;

	// image
	protected Sprite mSprite;
}
